package com.facebook.drawee.backends.pipeline;

import android.content.Context;
import android.net.Uri;
import com.facebook.cache.common.CacheKey;
import com.facebook.common.references.CloseableReference;
import com.facebook.datasource.DataSource;
import com.facebook.drawee.controller.AbstractDraweeControllerBuilder;
import com.facebook.drawee.controller.ControllerListener;
import com.facebook.drawee.interfaces.DraweeController;
import com.facebook.imagepipeline.cache.CacheKeyFactory;
import com.facebook.imagepipeline.core.ImagePipeline;
import com.facebook.imagepipeline.image.CloseableImage;
import com.facebook.imagepipeline.image.ImageInfo;
import com.facebook.imagepipeline.request.ImageRequest;
import java.util.Set;
import javax.annotation.Nullable;

public class PipelineDraweeControllerBuilder extends AbstractDraweeControllerBuilder<PipelineDraweeControllerBuilder, ImageRequest, CloseableReference<CloseableImage>, ImageInfo>
{
  private final ImagePipeline mImagePipeline;
  private final PipelineDraweeControllerFactory mPipelineDraweeControllerFactory;

  public PipelineDraweeControllerBuilder(Context paramContext, PipelineDraweeControllerFactory paramPipelineDraweeControllerFactory, ImagePipeline paramImagePipeline, Set<ControllerListener> paramSet)
  {
    super(paramContext, paramSet);
    this.mImagePipeline = paramImagePipeline;
    this.mPipelineDraweeControllerFactory = paramPipelineDraweeControllerFactory;
  }

  private CacheKey getCacheKey()
  {
    ImageRequest localImageRequest = (ImageRequest)getImageRequest();
    CacheKeyFactory localCacheKeyFactory = this.mImagePipeline.getCacheKeyFactory();
    CacheKey localCacheKey = null;
    if (localCacheKeyFactory != null)
    {
      localCacheKey = null;
      if (localImageRequest != null)
      {
        if (localImageRequest.getPostprocessor() == null)
          break label49;
        localCacheKey = localCacheKeyFactory.getPostprocessedBitmapCacheKey(localImageRequest, getCallerContext());
      }
    }
    return localCacheKey;
    label49: return localCacheKeyFactory.getBitmapCacheKey(localImageRequest, getCallerContext());
  }

  protected DataSource<CloseableReference<CloseableImage>> getDataSourceForRequest(ImageRequest paramImageRequest, Object paramObject, boolean paramBoolean)
  {
    if (paramBoolean)
      return this.mImagePipeline.fetchImageFromBitmapCache(paramImageRequest, paramObject);
    return this.mImagePipeline.fetchDecodedImage(paramImageRequest, paramObject);
  }

  protected PipelineDraweeControllerBuilder getThis()
  {
    return this;
  }

  protected PipelineDraweeController obtainController()
  {
    DraweeController localDraweeController = getOldController();
    if ((localDraweeController instanceof PipelineDraweeController))
    {
      PipelineDraweeController localPipelineDraweeController = (PipelineDraweeController)localDraweeController;
      localPipelineDraweeController.initialize(obtainDataSourceSupplier(), generateUniqueControllerId(), getCacheKey(), getCallerContext());
      return localPipelineDraweeController;
    }
    return this.mPipelineDraweeControllerFactory.newController(obtainDataSourceSupplier(), generateUniqueControllerId(), getCacheKey(), getCallerContext());
  }

  public PipelineDraweeControllerBuilder setUri(Uri paramUri)
  {
    return (PipelineDraweeControllerBuilder)super.setImageRequest(ImageRequest.fromUri(paramUri));
  }

  public PipelineDraweeControllerBuilder setUri(@Nullable String paramString)
  {
    return (PipelineDraweeControllerBuilder)super.setImageRequest(ImageRequest.fromUri(paramString));
  }
}

/* Location:           C:\Users\user\Desktop\dd28_pcdd720\classes_dex2jar.jar
 * Qualified Name:     com.facebook.drawee.backends.pipeline.PipelineDraweeControllerBuilder
 * JD-Core Version:    0.6.2
 */